	.module wssccc.c
	.area text(rom, con, rel)
	.dbfile E:\avr\wssccc_robot_1.1\wssccc.c
	.dbfile E:\avr\wssccc_robot_1.1\timer1.h
	.dbfunc e timer1_init _timer1_init fV
	.even
_timer1_init::
	.dbline -1
	.dbline 29
; //timer implementation
; //wssccc ROBOT SDK 1.1
; 
; //2010-4-15
; 
; /*
;  __  __  __    ____    ____    ___    ___    ___   
; /\ \/\ \/\ \  /',__\  /',__\  /'___\ /'___\ /'___\ 
; \ \ \_/ \_/ \/\__, `\/\__, `\/\ \__//\ \__//\ \__/ 
;  \ \___x___/'\/\____/\/\____/\ \____\ \____\ \____\
;   \/__//__/   \/___/  \/___/  \/____/\/____/\/____/
;   
; MAIL : wssccc@gmail.com                                                    
;   */
; 
; //ICC-AVR application builder : 2010/4/15 16:39:35
; // Target : m48
; // Crystal: 8.0000Mhz
; 
; #include <iom48v.h>
; #include <macros.h>
; 
; 
; //TIMER1 initialize - prescale:256
; // WGM: 0) Normal, TOP=0xFFFF
; // desired value: 5Hz
; // actual value:  5.000Hz (0.0%)
; void timer1_init(void)
; {
	.dbline 30
;  TCCR1B = 0x00; //stop
	clr R2
	sts 129,R2
	.dbline 31
;  TCNT1H = 0xE7; //setup
	ldi R24,231
	sts 133,R24
	.dbline 32
;  TCNT1L = 0x96;
	ldi R24,150
	sts 132,R24
	.dbline 33
;  OCR1AH = 0x18;
	ldi R24,24
	sts 137,R24
	.dbline 34
;  OCR1AL = 0x6A;
	ldi R24,106
	sts 136,R24
	.dbline 35
;  OCR1BH = 0x18;
	ldi R24,24
	sts 139,R24
	.dbline 36
;  OCR1BL = 0x6A;
	ldi R24,106
	sts 138,R24
	.dbline 37
;  ICR1H  = 0x18;
	ldi R24,24
	sts 135,R24
	.dbline 38
;  ICR1L  = 0x6A;
	ldi R24,106
	sts 134,R24
	.dbline 39
;  TCCR1A = 0x00;
	sts 128,R2
	.dbline 40
;  TCCR1B = 0x04; //start Timer
	ldi R24,4
	sts 129,R24
	.dbline -2
L1:
	.dbline 0 ; func end
	ret
	.dbend
	.area vector(rom, abs)
	.org 26
	rjmp _timer1_ovf_isr
	.area text(rom, con, rel)
	.dbfile E:\avr\wssccc_robot_1.1\timer1.h
	.dbfunc e timer1_ovf_isr _timer1_ovf_isr fV
	.even
_timer1_ovf_isr::
	st -y,R24
	in R24,0x3f
	st -y,R24
	.dbline -1
	.dbline 51
; }
; 
; //ICC-AVR application builder : 2010/4/15 17:40:48
; // Target : m48
; // Crystal: 8.0000Mhz
; 
; 
; 
; #pragma interrupt_handler timer1_ovf_isr:14
; void timer1_ovf_isr(void)
; {
	.dbline 53
;  //TIMER1 has overflowed
;  TCNT1H = 0xE7; //reload counter high value
	ldi R24,231
	sts 133,R24
	.dbline 54
;  TCNT1L = 0x96; //reload counter low value
	ldi R24,150
	sts 132,R24
	.dbline -2
L2:
	.dbline 0 ; func end
	ld R24,y+
	out 0x3f,R24
	ld R24,y+
	reti
	.dbend
	.area vector(rom, abs)
	.org 2
	rjmp _int0_isr
	.area text(rom, con, rel)
	.dbfile E:\avr\wssccc_robot_1.1\timer1.h
	.dbfile E:\avr\wssccc_robot_1.1\int_handle.h
	.dbfunc e int0_isr _int0_isr fV
	.even
_int0_isr::
	st -y,R16
	st -y,R17
	st -y,R18
	st -y,R19
	in R16,0x3f
	st -y,R16
	.dbline -1
	.dbline 24
; //int handlers
; //wssccc ROBOT SDK 1.1
; 
; //2010-4-15
; 
; /*
;  __  __  __    ____    ____    ___    ___    ___   
; /\ \/\ \/\ \  /',__\  /',__\  /'___\ /'___\ /'___\ 
; \ \ \_/ \_/ \/\__, `\/\__, `\/\ \__//\ \__//\ \__/ 
;  \ \___x___/'\/\____/\/\____/\ \____\ \____\ \____\
;   \/__//__/   \/___/  \/___/  \/____/\/____/\/____/
;   
; MAIL : wssccc@gmail.com                                                    
;   */
;   
; #define MAX_COUNTER 1000
; //global var
; int g_leftCounter;
; int g_rightCounter;
; 
; 
; #pragma interrupt_handler int0_isr:2
; void int0_isr(void)
; {
	.dbline 26
;  //external interupt on INT0
;  g_leftCounter=(g_leftCounter+1) % MAX_COUNTER;
	ldi R18,1000
	ldi R19,3
	lds R16,_g_leftCounter
	lds R17,_g_leftCounter+1
	subi R16,255  ; offset = 1
	sbci R17,255
	rcall mod16s
	sts _g_leftCounter+1,R17
	sts _g_leftCounter,R16
	.dbline -2
L3:
	.dbline 0 ; func end
	ld R16,y+
	out 0x3f,R16
	ld R19,y+
	ld R18,y+
	ld R17,y+
	ld R16,y+
	reti
	.dbend
	.area vector(rom, abs)
	.org 4
	rjmp _int1_isr
	.area text(rom, con, rel)
	.dbfile E:\avr\wssccc_robot_1.1\int_handle.h
	.dbfunc e int1_isr _int1_isr fV
	.even
_int1_isr::
	st -y,R16
	st -y,R17
	st -y,R18
	st -y,R19
	in R16,0x3f
	st -y,R16
	.dbline -1
	.dbline 32
;  
; }
; 
; #pragma interrupt_handler int1_isr:3
; void int1_isr(void)
; {
	.dbline 34
;  //external interupt on INT1
;  g_rightCounter=(g_rightCounter+1) % MAX_COUNTER;
	ldi R18,1000
	ldi R19,3
	lds R16,_g_rightCounter
	lds R17,_g_rightCounter+1
	subi R16,255  ; offset = 1
	sbci R17,255
	rcall mod16s
	sts _g_rightCounter+1,R17
	sts _g_rightCounter,R16
	.dbline -2
L4:
	.dbline 0 ; func end
	ld R16,y+
	out 0x3f,R16
	ld R19,y+
	ld R18,y+
	ld R17,y+
	ld R16,y+
	reti
	.dbend
	.dbfunc e stopTest _stopTest fI
	.even
_stopTest::
	.dbline -1
	.dbline 38
;  
; }
; 
; int stopTest(){
	.dbline 39
; 	g_leftCounter=0;
	clr R2
	clr R3
	sts _g_leftCounter+1,R3
	sts _g_leftCounter,R2
	.dbline 40
; 	g_rightCounter=0;
	sts _g_rightCounter+1,R3
	sts _g_rightCounter,R2
	.dbline 41
; 	forward(5,LOW_SPEED);
	ldi R18,15
	ldi R19,0
	ldi R16,5
	ldi R17,0
	rcall _forward
	.dbline 42
; 	if((!g_leftCounter)||(!g_rightCounter)){
	lds R2,_g_leftCounter
	lds R3,_g_leftCounter+1
	tst R2
	brne X0
	tst R3
	breq L8
X0:
	lds R2,_g_rightCounter
	lds R3,_g_rightCounter+1
	tst R2
	brne L6
	tst R3
	brne L6
X1:
L8:
	.dbline 42
	.dbline 43
; 			return 1;
	ldi R16,1
	ldi R17,0
	rjmp L5
L6:
	.dbline 44
; 	}else{
	.dbline 45
; 		    return 0;
	clr R16
	clr R17
	.dbline -2
L5:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfile E:\avr\wssccc_robot_1.1\wssccc.h
	.dbfunc e delay_us _delay_us fV
;           time -> R16,R17
	.even
_delay_us::
	.dbline -1
	.dbline 68
; //wssccc header file
; //wssccc ROBOT SDK 1.1 
; 
; //2010-4-15
; 
; /*
;  __  __  __    ____    ____    ___    ___    ___   
; /\ \/\ \/\ \  /',__\  /',__\  /'___\ /'___\ /'___\ 
; \ \ \_/ \_/ \/\__, `\/\__, `\/\ \__//\ \__//\ \__/ 
;  \ \___x___/'\/\____/\/\____/\ \____\ \____\ \____\
;   \/__//__/   \/___/  \/___/  \/____/\/____/\/____/
;   
; MAIL : wssccc@gmail.com                                                    
;   */
; 
; 
; // Target : m48
; // Crystal: 8.0000Mhz
; 
; //code options
; #define USE_TIMER	 1
; #define USE_INT	 1
; 
; 
; #include <iom48v.h>
; #include <macros.h>
; 
; 
; //------------------------------Macro functions---------------------------------
; #define setBit(P,B) ((P)|=(1<<B))
; #define clearBit(P,B) ((P)&=~(1<<B))
; #define getBit(P,B) ((P)&(1<<B))
; 
; #define impact(x) !getBit(PINC,x)  //return true if in sight
; #define light_on(x) clearBit(PORTB,x);
; #define light_off(x) setBit(PORTB,x);
; 
; //------------------------------Device definitions------------------------------
; #define FORE_SENSOR 3
; #define LEFT_SENSOR 1
; #define RIGHT_SENSOR 2
; 
; #define FORE_LED 0
; #define LEFT_LED 1
; #define RIGHT_LED 2
; 
; //-----------------------------physical data------------------------------------
; #define TURN_FACTOR 33
; #define TURN_FACTOR1 35
; #define STEP_FACTOR 14    //not correct
; 
; #define MAX_SPEED 100
; #define MIN_SPEED 6		  //depend on motor status
; #define LOW_SPEED 15
; 
; //-----------------------------optional includes--------------------------------
; #if USE_TIMER
; #include "timer1.h"  //use timer support
; #endif
; 
; #if USE_INT
; #include "int_handle.h" //use int handle support
; #endif
; 
; 
; //-----------------------------functions----------------------------------------
; 
; void delay_us(unsigned int time){
L10:
	.dbline 69
; 	while(time--);
L11:
	.dbline 69
	movw R2,R16
	subi R16,1
	sbci R17,0
	tst R2
	brne L10
	tst R3
	brne L10
X2:
	.dbline -2
L9:
	.dbline 0 ; func end
	ret
	.dbsym r time 16 i
	.dbend
	.dbfunc e delay_ms _delay_ms fV
;           time -> R20,R21
	.even
_delay_ms::
	st -y,R20
	st -y,R21
	movw R20,R16
	.dbline -1
	.dbline 72
; }
; 
; void delay_ms(unsigned int time){
	rjmp L15
L14:
	.dbline 73
; 	while(time--){
	.dbline 74
; 		delay_us(1000);
	ldi R16,1000
	ldi R17,3
	rcall _delay_us
	.dbline 75
; 	}
L15:
	.dbline 73
	movw R2,R20
	subi R20,1
	sbci R21,0
	tst R2
	brne L14
	tst R3
	brne L14
X3:
	.dbline -2
L13:
	.dbline 0 ; func end
	ld R21,y+
	ld R20,y+
	ret
	.dbsym r time 20 i
	.dbend
	.dbfunc e delay_s _delay_s fV
;           time -> R20,R21
	.even
_delay_s::
	st -y,R20
	st -y,R21
	movw R20,R16
	.dbline -1
	.dbline 78
; }
; 
; void delay_s(unsigned int time){
	rjmp L19
L18:
	.dbline 79
; 	while(time--){
	.dbline 80
; 		delay_ms(1000);
	ldi R16,1000
	ldi R17,3
	rcall _delay_ms
	.dbline 81
; 	}
L19:
	.dbline 79
	movw R2,R20
	subi R20,1
	sbci R21,0
	tst R2
	brne L18
	tst R3
	brne L18
X4:
	.dbline -2
L17:
	.dbline 0 ; func end
	ld R21,y+
	ld R20,y+
	ret
	.dbsym r time 20 i
	.dbend
	.dbfunc e waitSound _waitSound fV
	.even
_waitSound::
	.dbline -1
	.dbline 86
; }
; 
; 
; 
; void waitSound(){
	.dbline 87
; 	delay_s(1);
	ldi R16,1
	ldi R17,0
	rcall _delay_s
	.dbline 89
; 	
; 	clearBit(PORTC,PC5);
	cbi 0x8,5
L22:
	.dbline 90
; 	while(getBit(PINC,PC5)!=0){}
	.dbline 90
L23:
	.dbline 90
	sbic 0x6,5
	rjmp L22
X5:
	.dbline -2
L21:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e forward _forward fV
;              i -> R10,R11
;          speed -> R20,R21
;             cm -> R22,R23
	.even
_forward::
	rcall push_xgsetF00C
	movw R20,R18
	movw R22,R16
	.dbline -1
	.dbline 97
; 	
; }
; 
; 
; 
; 
; void forward(unsigned int cm,unsigned int speed){
	.dbline 99
; 	int i;
; 	if(cm<1)return;
	cpi R22,1
	ldi R30,0
	cpc R23,R30
	brsh L26
X6:
	.dbline 99
	rjmp L25
L26:
	.dbline 100
; 	speed+=MIN_SPEED;
	subi R20,250  ; offset = 6
	sbci R21,255
	rjmp L29
L28:
	.dbline 101
; 	while(--cm){
	.dbline 102
; 		i=STEP_FACTOR;
	ldi R24,14
	ldi R25,0
	movw R10,R24
	rjmp L32
L31:
	.dbline 103
; 		while(--i){
	.dbline 104
; 			PORTD=0x60;//01100000
	ldi R24,96
	out 0xb,R24
	.dbline 105
; 			delay_ms(speed);
	movw R16,R20
	rcall _delay_ms
	.dbline 106
; 			PORTD=0x00;
	clr R2
	out 0xb,R2
	.dbline 107
; 			delay_ms(MAX_SPEED/speed);
	ldi R16,100
	ldi R17,0
	movw R18,R20
	rcall div16u
	rcall _delay_ms
	.dbline 108
; 		}
L32:
	.dbline 103
	movw R24,R10
	sbiw R24,1
	movw R10,R24
	tst R10
	brne L31
	tst R11
	brne L31
X7:
	.dbline 109
; 	}
L29:
	.dbline 101
	movw R24,R22
	sbiw R24,1
	movw R22,R24
	cpi R22,0
	cpc R22,R23
	brne L28
X8:
	.dbline -2
L25:
	.dbline 0 ; func end
	rjmp pop_xgsetF00C
	.dbsym r i 10 I
	.dbsym r speed 20 i
	.dbsym r cm 22 i
	.dbend
	.dbfunc e backward _backward fV
;              i -> R10,R11
;          speed -> R20,R21
;             cm -> R22,R23
	.even
_backward::
	rcall push_xgsetF00C
	movw R20,R18
	movw R22,R16
	.dbline -1
	.dbline 115
; 	
; }
; 
; 
; 
; void backward(unsigned int cm,unsigned int speed){
	.dbline 117
; 	int i;
; 	if(cm<1)return;
	cpi R22,1
	ldi R30,0
	cpc R23,R30
	brsh L35
X9:
	.dbline 117
	rjmp L34
L35:
	.dbline 118
; 	speed+=MIN_SPEED;
	subi R20,250  ; offset = 6
	sbci R21,255
	rjmp L38
L37:
	.dbline 119
; 	while(--cm){
	.dbline 120
; 		i=STEP_FACTOR;
	ldi R24,14
	ldi R25,0
	movw R10,R24
	rjmp L41
L40:
	.dbline 121
; 		while(--i){
	.dbline 122
; 			PORTD=0x90;//10010000
	ldi R24,144
	out 0xb,R24
	.dbline 123
; 			delay_ms(speed);
	movw R16,R20
	rcall _delay_ms
	.dbline 124
; 			PORTD=0x00;
	clr R2
	out 0xb,R2
	.dbline 125
; 			delay_ms(MAX_SPEED/speed);
	ldi R16,100
	ldi R17,0
	movw R18,R20
	rcall div16u
	rcall _delay_ms
	.dbline 126
; 		}
L41:
	.dbline 121
	movw R24,R10
	sbiw R24,1
	movw R10,R24
	tst R10
	brne L40
	tst R11
	brne L40
X10:
	.dbline 127
; 	}
L38:
	.dbline 119
	movw R24,R22
	sbiw R24,1
	movw R22,R24
	cpi R22,0
	cpc R22,R23
	brne L37
X11:
	.dbline -2
L34:
	.dbline 0 ; func end
	rjmp pop_xgsetF00C
	.dbsym r i 10 I
	.dbsym r speed 20 i
	.dbsym r cm 22 i
	.dbend
	.dbfunc e turnRight _turnRight fV
;              i -> R22,R23
;          speed -> R20,R21
	.even
_turnRight::
	rcall push_xgsetF000
	movw R20,R16
	.dbline -1
	.dbline 133
; 	
; }
; 
; 
; 
; void turnRight(unsigned int speed){
	.dbline 135
; 	int i;
; 	PORTD=0x00;
	clr R2
	out 0xb,R2
	.dbline 136
; 	delay_ms(500);
	ldi R16,500
	ldi R17,1
	rcall _delay_ms
	.dbline 137
; 	speed+=MIN_SPEED;
	subi R20,250  ; offset = 6
	sbci R21,255
	.dbline 138
; 	for(i=0;i<TURN_FACTOR;++i){
	clr R22
	clr R23
L44:
	.dbline 138
	.dbline 139
; 		PORTD=0xa0;
	ldi R24,160
	out 0xb,R24
	.dbline 140
; 		delay_ms(speed);
	movw R16,R20
	rcall _delay_ms
	.dbline 141
; 		PORTD=0x00;
	clr R2
	out 0xb,R2
	.dbline 142
; 		delay_ms(MAX_SPEED/speed);
	ldi R16,100
	ldi R17,0
	movw R18,R20
	rcall div16u
	rcall _delay_ms
	.dbline 143
; 	}
L45:
	.dbline 138
	subi R22,255  ; offset = 1
	sbci R23,255
	.dbline 138
	cpi R22,33
	ldi R30,0
	cpc R23,R30
	brlt L44
X12:
	.dbline 145
; 
; 	delay_s(1);
	ldi R16,1
	ldi R17,0
	rcall _delay_s
	.dbline -2
L43:
	.dbline 0 ; func end
	rjmp pop_xgsetF000
	.dbsym r i 22 I
	.dbsym r speed 20 i
	.dbend
	.dbfunc e turnLeft _turnLeft fV
;              i -> R22,R23
;          speed -> R20,R21
	.even
_turnLeft::
	rcall push_xgsetF000
	movw R20,R16
	.dbline -1
	.dbline 149
; 	
; } 
; 
; void turnLeft(unsigned int speed){
	.dbline 151
; 	int i;
; 	PORTD=0x00;
	clr R2
	out 0xb,R2
	.dbline 152
; 	delay_ms(500);
	ldi R16,500
	ldi R17,1
	rcall _delay_ms
	.dbline 153
; 	speed+=MIN_SPEED;
	subi R20,250  ; offset = 6
	sbci R21,255
	.dbline 154
; 	for(i=0;i<TURN_FACTOR;++i){
	clr R22
	clr R23
L49:
	.dbline 154
	.dbline 156
; 
; 		PORTD=0x50;
	ldi R24,80
	out 0xb,R24
	.dbline 157
; 		delay_ms(speed);
	movw R16,R20
	rcall _delay_ms
	.dbline 158
; 		PORTD=0x00;
	clr R2
	out 0xb,R2
	.dbline 159
; 		delay_ms(MAX_SPEED/speed);
	ldi R16,100
	ldi R17,0
	movw R18,R20
	rcall div16u
	rcall _delay_ms
	.dbline 160
; 	}
L50:
	.dbline 154
	subi R22,255  ; offset = 1
	sbci R23,255
	.dbline 154
	cpi R22,33
	ldi R30,0
	cpc R23,R30
	brlt L49
X13:
	.dbline 161
; 	delay_s(1);
	ldi R16,1
	ldi R17,0
	rcall _delay_s
	.dbline -2
L48:
	.dbline 0 ; func end
	rjmp pop_xgsetF000
	.dbsym r i 22 I
	.dbsym r speed 20 i
	.dbend
	.dbfunc e detectSensors _detectSensors fV
	.even
_detectSensors::
	.dbline -1
	.dbline 165
; } 
; 
; 
; void detectSensors(){
	.dbline 166
; 	if(impact(FORE_SENSOR)){
	sbic 0x6,3
	rjmp L54
X14:
	.dbline 166
	.dbline 167
; 		light_on(FORE_LED);
	cbi 0x5,0
	.dbline 167
	.dbline 168
; 	}else{
	rjmp L55
L54:
	.dbline 168
	.dbline 169
; 		light_off(FORE_LED);
	sbi 0x5,0
	.dbline 169
	.dbline 170
; 	}
L55:
	.dbline 172
; 
; 	if(impact(LEFT_SENSOR)){
	sbic 0x6,1
	rjmp L56
X15:
	.dbline 172
	.dbline 173
; 		light_on(LEFT_LED);
	cbi 0x5,1
	.dbline 173
	.dbline 174
; 	}else{
	rjmp L57
L56:
	.dbline 174
	.dbline 175
; 		light_off(LEFT_LED);
	sbi 0x5,1
	.dbline 175
	.dbline 176
; 	}
L57:
	.dbline 178
; 	
; 	if(impact(RIGHT_SENSOR)){
	sbic 0x6,2
	rjmp L58
X16:
	.dbline 178
	.dbline 179
; 		light_on(RIGHT_LED);
	cbi 0x5,2
	.dbline 179
	.dbline 180
; 	}else{
	rjmp L59
L58:
	.dbline 180
	.dbline 181
; 		light_off(RIGHT_LED);
	sbi 0x5,2
	.dbline 181
	.dbline 182
; 	}
L59:
	.dbline -2
L53:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e port_init _port_init fV
	.even
_port_init::
	.dbline -1
	.dbline 187
; }
; 
; 
; void port_init(void)
; {
	.dbline 188
;  PORTB = 0x00;
	clr R2
	out 0x5,R2
	.dbline 189
;  DDRB  = 0x0F;
	ldi R24,15
	out 0x4,R24
	.dbline 190
;  PORTC = 0x00; //m103 output only
	out 0x8,R2
	.dbline 191
;  DDRC  = 0x00;
	out 0x7,R2
	.dbline 192
;  PORTD = 0x00;
	out 0xb,R2
	.dbline 193
;  DDRD  = 0xF3; //int0 and int1 enabled
	ldi R24,243
	out 0xa,R24
	.dbline -2
L60:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e init_devices _init_devices fV
	.even
_init_devices::
	.dbline -1
	.dbline 200
; }
; 
; //call this routine to initialize all peripherals
; 
; 
; void init_devices(void)
; {
	.dbline 202
;  //stop errant interrupts until set up
;  CLI(); //disable all interrupts
	cli
	.dbline 204
;  
;  port_init();
	rcall _port_init
	.dbline 207
; 
; #if USE_TIMER
;  timer1_init();
	rcall _timer1_init
	.dbline 210
; #endif
;  
;  MCUCR = 0x00;
	clr R2
	out 0x35,R2
	.dbline 211
;  EICRA = 0x00; //extended ext ints
	sts 105,R2
	.dbline 214
;  
; #if USE_INT
;  EIMSK = 0x03;
	ldi R24,3
	out 0x1d,R24
	.dbline 219
; #else
;  EIMSK = 0x00;
; #endif
;  
;  TIMSK0 = 0x00; //timer 0 interrupt sources
	sts 110,R2
	.dbline 222
;  
; #if USE_TIMER
;  TIMSK1 = 0x01; //timer 1 interrupt sources
	ldi R24,1
	sts 111,R24
	.dbline 228
; #else
;  TIMSK1 = 0x00; //timer 1 interrupt sources
; #endif
; 
; 
;  TIMSK2 = 0x00; //timer 2 interrupt sources
	sts 112,R2
	.dbline 230
;  
;  PCMSK0 = 0x00; //pin change mask 0 
	sts 107,R2
	.dbline 231
;  PCMSK1 = 0x00; //pin change mask 1 
	sts 108,R2
	.dbline 232
;  PCMSK2 = 0x00; //pin change mask 2
	sts 109,R2
	.dbline 233
;  PCICR = 0x00; //pin change enable 
	sts 104,R2
	.dbline 234
;  PRR = 0x00; //power controller
	sts 100,R2
	.dbline 235
;  SEI(); //re-enable interrupts
	sei
	.dbline -2
L61:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfile E:\avr\wssccc_robot_1.1\wssccc.c
	.dbfunc e mazeLoop _mazeLoop fV
	.even
_mazeLoop::
	.dbline -1
	.dbline 15
; /*
;  __  __  __    ____    ____    ___    ___    ___   
; /\ \/\ \/\ \  /',__\  /',__\  /'___\ /'___\ /'___\ 
; \ \ \_/ \_/ \/\__, `\/\__, `\/\ \__//\ \__//\ \__/ 
;  \ \___x___/'\/\____/\/\____/\ \____\ \____\ \____\
;   \/__//__/   \/___/  \/___/  \/____/\/____/\/____/
;                                                    
;   */
; 
; 
; //2010-4-15
; 
; #include "wssccc.h"
; 
; void mazeLoop(){
	rjmp L64
L63:
	.dbline 16
; 	while(1){
	.dbline 18
; 		
; 		detectSensors();
	rcall _detectSensors
	.dbline 21
; 		
; 		
; 		if(!impact(FORE_SENSOR)&&impact(LEFT_SENSOR))forward(5,10);
	sbis 0x6,3
	rjmp L66
X17:
	sbic 0x6,1
	rjmp L66
X18:
	.dbline 21
	ldi R18,10
	ldi R19,0
	ldi R16,5
	ldi R17,0
	rcall _forward
L66:
	.dbline 23
; 		
; 		if(impact(FORE_SENSOR)&&impact(RIGHT_SENSOR)){
	sbic 0x6,3
	rjmp L68
X19:
	sbic 0x6,2
	rjmp L68
X20:
	.dbline 23
	.dbline 24
; 			turnLeft(10);
	ldi R16,10
	ldi R17,0
	rcall _turnLeft
	.dbline 25
; 			forward(5,10);
	ldi R18,10
	ldi R19,0
	ldi R16,5
	ldi R17,0
	rcall _forward
	.dbline 26
; 		}
L68:
	.dbline 28
; 						  
; 		if(impact(LEFT_SENSOR)&&impact(FORE_SENSOR))turnRight(10);
	sbic 0x6,1
	rjmp L70
X21:
	sbic 0x6,3
	rjmp L70
X22:
	.dbline 28
	ldi R16,10
	ldi R17,0
	rcall _turnRight
L70:
	.dbline 30
; 		
; 		if(!impact(FORE_SENSOR)&&!impact(LEFT_SENSOR)&&!impact(RIGHT_SENSOR)){
	sbis 0x6,3
	rjmp L72
X23:
	sbis 0x6,1
	rjmp L72
X24:
	sbis 0x6,2
	rjmp L72
X25:
	.dbline 30
	.dbline 31
; 			backward(1,5);
	ldi R18,5
	ldi R19,0
	ldi R16,1
	ldi R17,0
	rcall _backward
	.dbline 32
; 		}
L72:
	.dbline 42
; 		
; 
; #if CRITICAL	
; 		if(impact(FORE_SENSOR)&&!impact(LEFT_SENSOR)){
; 			while(!impact(LEFT_SENSOR))backward(2);
; 		}
; #endif
; 		
; 		
; 	}
L64:
	.dbline 16
	rjmp L63
X26:
	.dbline -2
L62:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e main _main fV
;              i -> <dead>
	.even
_main::
	.dbline -1
	.dbline 47
; }
; 
; 
; 
; void main(){
	.dbline 49
; 	int i;
; 	init_devices();
	rcall _init_devices
	.dbline 54
; 	
; 	
; 	//while(1)detectSensors();
; 	
; 	mazeLoop();
	rcall _mazeLoop
	.dbline -2
L74:
	.dbline 0 ; func end
	ret
	.dbsym l i 1 I
	.dbend
	.area bss(ram, con, rel)
	.dbfile E:\avr\wssccc_robot_1.1\wssccc.c
_g_rightCounter::
	.blkb 2
	.dbfile E:\avr\wssccc_robot_1.1\int_handle.h
	.dbsym e g_rightCounter _g_rightCounter I
_g_leftCounter::
	.blkb 2
	.dbsym e g_leftCounter _g_leftCounter I
; 	
; 	
; 	
; 	
; }
